package com.rajaev.dtu.tractor.app.service;

import com.github.pagehelper.PageInfo;
import com.rajaev.dtu.tractor.domain.entity.UserInfo;
import com.rajaev.dtu.tractor.domain.vo.ResourceVo;
import com.rajaev.dtu.tractor.domain.vo.UserVo;
import com.rajaev.dtu.tractor.infrastructure.base.errors.BusinessException;
import com.rajaev.dtu.tractor.interfaces.dto.LoginResponseDto;

import java.util.List;

public interface UserService {

    /**
     * 根据用户的登录名查询用户
     * @param loginName 登录名
     * @return
     */
    UserInfo queryUserInfo(String loginName);




    /**
     * 根据登录名查询用户信息
     *
     * @param loginName
     * @return
     * @throws BusinessException
     */
    UserInfo getUserByLoginName(String loginName) throws BusinessException;


    /**
     * 获取用户的所属的客户的id
     * @param userId
     * @return
     */
    List<Integer> selectUserCustomerIds(Integer userId);

    LoginResponseDto auth(String loginName, String password) throws BusinessException;

    void logout(String token);




    void insertUser(UserVo userVo) throws BusinessException;

    void editUser(UserVo userVo) throws BusinessException;

    /**
     * 修改用户的显示名
     * @param userId
     * @param systemDisplayName
     */
    void updateUserSystemDisplayName(Integer userId,String systemDisplayName);


    PageInfo<UserVo> pageQueryUsers(Integer pageSize, Integer pageNum);

    void deleteUser(Integer userId);

    void resetPassword(Integer userId);

    void updateOriginalPassword(String newPassword,UserInfo userInfo) throws BusinessException;

    void updatePassword(Integer userId, String newPassword,String oldPassword) throws BusinessException;

    List<ResourceVo> selectResource(Integer userId);
}
